<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>Faiss: faiss::HeapArray&lt; C &gt; Struct Template Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">Faiss
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Friends</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespacefaiss.html">faiss</a></li><li class="navelem"><a class="el" href="structfaiss_1_1HeapArray.html">HeapArray</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-types">Public Types</a> &#124;
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pub-attribs">Public Attributes</a> &#124;
<a href="structfaiss_1_1HeapArray-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">faiss::HeapArray&lt; C &gt; Struct Template Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p><code>#include &lt;<a class="el" href="Heap_8h_source.html">Heap.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-types"></a>
Public Types</h2></td></tr>
<tr class="memitem:a284762db4e64dd74d82984b6b457304a"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a284762db4e64dd74d82984b6b457304a"></a>
typedef C::TI&#160;</td><td class="memItemRight" valign="bottom"><b>TI</b></td></tr>
<tr class="separator:a284762db4e64dd74d82984b6b457304a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a46eb2eae9e79a0dd7ab720283619a5a9"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a46eb2eae9e79a0dd7ab720283619a5a9"></a>
typedef C::T&#160;</td><td class="memItemRight" valign="bottom"><b>T</b></td></tr>
<tr class="separator:a46eb2eae9e79a0dd7ab720283619a5a9"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:ae97911f6f85d152a5b45e459063b6858"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ae97911f6f85d152a5b45e459063b6858"></a>
T *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1HeapArray.html#ae97911f6f85d152a5b45e459063b6858">get_val</a> (size_t key)</td></tr>
<tr class="memdesc:ae97911f6f85d152a5b45e459063b6858"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the list of values for a heap. <br/></td></tr>
<tr class="separator:ae97911f6f85d152a5b45e459063b6858"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af6aa57addaa1bc754d09a2a08be4df49"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="af6aa57addaa1bc754d09a2a08be4df49"></a>
TI *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1HeapArray.html#af6aa57addaa1bc754d09a2a08be4df49">get_ids</a> (size_t key)</td></tr>
<tr class="memdesc:af6aa57addaa1bc754d09a2a08be4df49"><td class="mdescLeft">&#160;</td><td class="mdescRight">Correspponding identifiers. <br/></td></tr>
<tr class="separator:af6aa57addaa1bc754d09a2a08be4df49"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a48afc496c73e982b8e10fde786628292"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a48afc496c73e982b8e10fde786628292"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1HeapArray.html#a48afc496c73e982b8e10fde786628292">heapify</a> ()</td></tr>
<tr class="memdesc:a48afc496c73e982b8e10fde786628292"><td class="mdescLeft">&#160;</td><td class="mdescRight">prepare all the heaps before adding <br/></td></tr>
<tr class="separator:a48afc496c73e982b8e10fde786628292"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abc3e17a9d369abc87353bccf07f7a4fc"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1HeapArray.html#abc3e17a9d369abc87353bccf07f7a4fc">addn</a> (size_t nj, const T *vin, TI j0=0, size_t i0=0, long ni=-1)</td></tr>
<tr class="separator:abc3e17a9d369abc87353bccf07f7a4fc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad3c61085b43dd54300ad97f1f9503330"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1HeapArray.html#ad3c61085b43dd54300ad97f1f9503330">addn_with_ids</a> (size_t nj, const T *vin, const TI *id_in=nullptr, long id_stride=0, size_t i0=0, long ni=-1)</td></tr>
<tr class="separator:ad3c61085b43dd54300ad97f1f9503330"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3c686b3cc0594e6a284fa3a595bebdec"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a3c686b3cc0594e6a284fa3a595bebdec"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1HeapArray.html#a3c686b3cc0594e6a284fa3a595bebdec">reorder</a> ()</td></tr>
<tr class="memdesc:a3c686b3cc0594e6a284fa3a595bebdec"><td class="mdescLeft">&#160;</td><td class="mdescRight">reorder all the heaps <br/></td></tr>
<tr class="separator:a3c686b3cc0594e6a284fa3a595bebdec"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab1beefd73c023168c23d5443ee71e369"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1HeapArray.html#ab1beefd73c023168c23d5443ee71e369">per_line_extrema</a> (T *vals_out, TI *idx_out) const </td></tr>
<tr class="separator:ab1beefd73c023168c23d5443ee71e369"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-attribs"></a>
Public Attributes</h2></td></tr>
<tr class="memitem:aad477a3907c3496159eaf4b375be4432"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aad477a3907c3496159eaf4b375be4432"></a>
size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1HeapArray.html#aad477a3907c3496159eaf4b375be4432">nh</a></td></tr>
<tr class="memdesc:aad477a3907c3496159eaf4b375be4432"><td class="mdescLeft">&#160;</td><td class="mdescRight">number of heaps <br/></td></tr>
<tr class="separator:aad477a3907c3496159eaf4b375be4432"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1ee98429c766c77235f78c6d9aa32bb4"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a1ee98429c766c77235f78c6d9aa32bb4"></a>
size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1HeapArray.html#a1ee98429c766c77235f78c6d9aa32bb4">k</a></td></tr>
<tr class="memdesc:a1ee98429c766c77235f78c6d9aa32bb4"><td class="mdescLeft">&#160;</td><td class="mdescRight">allocated size per heap <br/></td></tr>
<tr class="separator:a1ee98429c766c77235f78c6d9aa32bb4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a22332dd179ce70e379addeaa47246cc2"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a22332dd179ce70e379addeaa47246cc2"></a>
TI *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1HeapArray.html#a22332dd179ce70e379addeaa47246cc2">ids</a></td></tr>
<tr class="memdesc:a22332dd179ce70e379addeaa47246cc2"><td class="mdescLeft">&#160;</td><td class="mdescRight">identifiers (size nh * k) <br/></td></tr>
<tr class="separator:a22332dd179ce70e379addeaa47246cc2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4b131abb659e7d0ee315223270deac53"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a4b131abb659e7d0ee315223270deac53"></a>
T *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1HeapArray.html#a4b131abb659e7d0ee315223270deac53">val</a></td></tr>
<tr class="memdesc:a4b131abb659e7d0ee315223270deac53"><td class="mdescLeft">&#160;</td><td class="mdescRight">values (distances or similarities), size nh * k <br/></td></tr>
<tr class="separator:a4b131abb659e7d0ee315223270deac53"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><h3>template&lt;typename C&gt;<br/>
struct faiss::HeapArray&lt; C &gt;</h3>

<p>a template structure for a set of [min|max]-heaps it is tailored so that the actual data of the heaps can just live in compact arrays. </p>

<p>Definition at line <a class="el" href="Heap_8h_source.html#l00350">350</a> of file <a class="el" href="Heap_8h_source.html">Heap.h</a>.</p>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="abc3e17a9d369abc87353bccf07f7a4fc"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename C &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="structfaiss_1_1HeapArray.html">faiss::HeapArray</a>&lt; C &gt;::addn </td>
          <td>(</td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>nj</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const T *&#160;</td>
          <td class="paramname"><em>vin</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">TI&#160;</td>
          <td class="paramname"><em>j0</em> = <code>0</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>i0</em> = <code>0</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">long&#160;</td>
          <td class="paramname"><em>ni</em> = <code>-1</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>add nj elements to heaps i0:i0+ni, with sequential ids</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">nj</td><td>nb of elements to add to each heap </td></tr>
    <tr><td class="paramname">vin</td><td>elements to add, size ni * nj </td></tr>
    <tr><td class="paramname">j0</td><td>add this to the ids that are added </td></tr>
    <tr><td class="paramname">i0</td><td>first heap to update </td></tr>
    <tr><td class="paramname">ni</td><td>nb of elements to update (-1 = use nh) </td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="Heap_8cpp_source.html#l00042">42</a> of file <a class="el" href="Heap_8cpp_source.html">Heap.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="ad3c61085b43dd54300ad97f1f9503330"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename C &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="structfaiss_1_1HeapArray.html">faiss::HeapArray</a>&lt; C &gt;::addn_with_ids </td>
          <td>(</td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>nj</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const T *&#160;</td>
          <td class="paramname"><em>vin</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const TI *&#160;</td>
          <td class="paramname"><em>id_in</em> = <code>nullptr</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">long&#160;</td>
          <td class="paramname"><em>id_stride</em> = <code>0</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>i0</em> = <code>0</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">long&#160;</td>
          <td class="paramname"><em>ni</em> = <code>-1</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>same as addn</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">id_in</td><td>ids of the elements to add, size ni * nj </td></tr>
    <tr><td class="paramname">id_stride</td><td>stride for id_in </td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="Heap_8cpp_source.html#l00064">64</a> of file <a class="el" href="Heap_8cpp_source.html">Heap.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="ab1beefd73c023168c23d5443ee71e369"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename C &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="structfaiss_1_1HeapArray.html">faiss::HeapArray</a>&lt; C &gt;::per_line_extrema </td>
          <td>(</td>
          <td class="paramtype">T *&#160;</td>
          <td class="paramname"><em>vals_out</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">TI *&#160;</td>
          <td class="paramname"><em>idx_out</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td> const</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>this is not really a heap function. It just finds the per-line extrema of each line of array D </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">vals_out</td><td>extreme value of each line (size nh, or NULL) </td></tr>
    <tr><td class="paramname">idx_out</td><td>index of extreme value (size nh or NULL) </td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="Heap_8cpp_source.html#l00092">92</a> of file <a class="el" href="Heap_8cpp_source.html">Heap.cpp</a>.</p>

</div>
</div>
<hr/>The documentation for this struct was generated from the following files:<ul>
<li>/data/users/matthijs/github_faiss/faiss/<a class="el" href="Heap_8h_source.html">Heap.h</a></li>
<li>/data/users/matthijs/github_faiss/faiss/<a class="el" href="Heap_8cpp_source.html">Heap.cpp</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.5
</small></address>
</body>
</html>
